
<form class="layui-form m-10">
  <div class="layui-form-item">
    <label class="layui-form-label">权限图标</label>
    <div class="layui-input-inline">
      <input type="text" name="icon" lay-verify="" placeholder="请输入权限图标" autocomplete="off" class="layui-input">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">权限名称</label>
    <div class="layui-input-inline">
      <input type="text" name="menuname" lay-verify="required" placeholder="请输入权限名称" autocomplete="off" class="layui-input">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">控制器名称</label>
    <div class="layui-input-inline">
      <input type="text" name="controller" placeholder="请输入控制器名称" autocomplete="off"  class="layui-input">
    </div>
    
    <div class="layui-form-mid layui-word-aux"></div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">方法名称</label>
    <div class="layui-input-inline">
      <input type="text" name="action"  placeholder="请输入方法名称" autocomplete="off"  class="layui-input">
     
    </div>
     <div class="layui-form-mid layui-word-aux"></div>
  </div>
  <input type="hidden" name="pid" value="{$id}">
  <div class="layui-form-item">
    <div class="layui-input-block">
      <button class="layui-btn" lay-submit lay-filter="addmenu">立即提交</button>
      <button type="reset" class="layui-btn layui-btn-primary">重置</button>
    </div>
  </div>
</form>
<script>

	  form.on('submit(addmenu)', function(data){
	    var userInfo = data.field;
		var url = "__SELF__";
		$.post(url,userInfo,function(data){
			if(data.code == '4001'){
				  layer.msg(data.msg,{icon: 5});
				  return;
			  }else if(data.code == '101'){
				  layer.msg(data.msg, {
					  icon: 6,
					  time: 2000
					}, function(){
					   location.reload();
					}); 
			  }
		});
	    return false;
	  });

</script>